<template>
	<view class="c" v-if="show">
		<u-waterfall v-model="flowList" ref="uWaterfall">
			<template v-slot:left="{leftList}">
				<view class="demo-warter" v-for="(item, index) in leftList" :key="index">
					<navigator :url="'/pages/detail/detail?id=' + item.dId">
						<u-lazy-load threshold="-250" border-radius="10" :image="item.dPicture" :index="index"></u-lazy-load>
						<view class="demo-title">
							{{item.dTitle}}
						</view>
						<view class="demo-tag">
							<view class="demo-tag-owner">
								<image class="image" :src="item.uAvatar" mode=""></image>
							</view>
							<view v-if="item.sName !== null" class="demo-tag-text">
								{{item.sName}}
							</view>
							<view v-else class="demo-tag-text">
								{{item.uName}}
							</view>
							<view class="demo-tag-favorite">
								<u-icon name="thumb-up"></u-icon>
								<text>{{item.dFavorite}}</text>
							</view>
						</view>
					</navigator>
				</view>	
			</template>
			<template v-slot:right="{rightList}">
				<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
					<navigator :url="'/pages/detail/detail?id=' + item.dId">
						<u-lazy-load threshold="-250" border-radius="10" :image="item.dPicture" :index="index"></u-lazy-load>
						<view class="demo-title">
							{{item.dTitle}}
						</view>
						<view class="demo-tag">
							<view class="demo-tag-owner">
								<image class="image" :src="item.uAvatar" mode=""></image>
							</view>
							<view v-if="item.sName !== null" class="demo-tag-text">
								{{item.sName}}
							</view>
							<view v-else class="demo-tag-text">
								{{item.uName}}
							</view>
							<view class="demo-tag-favorite">
								<u-icon name="thumb-up"></u-icon>
								{{item.dFavorite}}
							</view>
						</view>
					</navigator>
				</view>
			</template>
		</u-waterfall>
	</view>
</template>

<script>
	import bus from '../../utils/index.js'
	export default {
		props:['flowList'],
		data() 
		{
			return {
				show:true
			}
		},
		computed:{
			flow:{
				get(){
					this.test = this.flowList
					return this.flowList
				},
				set(val){
					this.flowList = val
				}
			}
		},
		mounted()
		{
			var that = this
			bus.$on('daily',function(msg){

			})
		},
		methods: {
			
		}
	}
</script>

<style>
	/* page不能写带scope的style标签中，否则无效 */
	page {
		background-color: rgb(240, 240, 240);
	}
</style>

<style lang="scss" scoped>
	.demo-warter {
		border-radius: 8px;
		margin: 5px;
		background-color: #ffffff;
		padding: 8px;
		position: relative;
	}
	
	.u-close {
		position: absolute;
		top: 32rpx;
		right: 32rpx;
	}
	
	.demo-image {
		width: 100%;
		border-radius: 4px;
	}
	
	.demo-title {
		font-size: 28rpx;
		margin-top: 5px;
		color: $u-main-color;
	}
	
	.demo-tag {
		display: flex;
		margin-top: 5px;
	}
	
	.demo-tag-owner {
		width: 40rpx;
		height: 40rpx;
		.image
		{
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}
	
	.demo-tag-text {
		width: 180rpx;
		line-height: 1.6;
		padding: 4rpx 14rpx;
		align-items: center;
		font-size: 20rpx;
		text-overflow:ellipsis;
		align-items: center;
		display: -webkit-box;
		word-break: break-all;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		overflow: hidden;
	}
	.demo-tag-favorite
	{
		margin-left: 20rpx;
		border-radius: 50rpx;
		line-height: 1;
		padding: 4rpx 14rpx;
		display: flex;
		align-items: center;
		border-radius: 50rpx;
		font-size: 20rpx;
		text
		{
			padding-left: 6rpx;
		}
	}
	
	.demo-price {
		font-size: 30rpx;
		color: $u-type-error;
		margin-top: 5px;
	}
	
	.demo-shop {
		font-size: 22rpx;
		color: $u-tips-color;
		margin-top: 5px;
	}
	

</style>
